﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace AlbumDesigner.Helpers
{
    public class UploadHelper
    {

        private static string FilenameToSessionKey(string filename)
        {
            return "File_" + filename;
        }

        public static void CreateFileGuidInSession(string filename)
        {
            var key = FilenameToSessionKey(filename);
            var guid = Guid.NewGuid().ToString().Substring(0, 6) + Path.GetExtension(filename);

            HttpContext.Current.Session[key] = guid;
        }

        public static string GetFileGuidFromSession(string filename)
        {
            var key = FilenameToSessionKey(filename);
            return HttpContext.Current.Session[key] as string;
        }

        public static void RemoveFileGuidFromSession(string filename)
        {
            var key = FilenameToSessionKey(filename);
            HttpContext.Current.Session.Remove(key);
        }
    }

    


    

}